package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.FinanceDepositCheckModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by yitianle on 2017/8/2.
 */
public interface FinanceDepositCheckRepository extends JpaRepository<FinanceDepositCheckModel, Integer>, JpaSpecificationExecutor<FinanceDepositCheckModel> {

    @Query("select check from FinanceDepositCheckModel check  where check.quotaId = ?1 ")
    FinanceDepositCheckModel findDepositCheckByQuota(String quotaId);

    @Query("select check from FinanceDepositCheckModel check  where check.initialQuotation = ?1 and  check.checkStatus =?2 order by check.id DESC ")
    List<FinanceDepositCheckModel> findDepositCheckByInitQuotaAndStatus(String quotaId, String status);

    @Query("select check from FinanceDepositCheckModel check  where check.initialQuotation = ?1 order by check.id DESC ")
    FinanceDepositCheckModel findDepositCheckByInitQuota(String InitQuota);
}
